def print_with_borders(str, end='\n'):
    print('|', str, '|', sep='', flush=True, end=end)


def dump_arr(arr):
    for i in arr:
        print_with_borders(i, ', ')
    print(flush=True)


def find_all(st, tgt):
    le = len(st)
    arr = []
    idx = -1
    while True:
        idx = st.find(tgt, idx + 1)
        if -1 == idx:
            break
        print('find_all: found: ', idx)
        arr.append(idx)
    return arr


st = '   Python is good, but also hard, especially with good teachers and good classmates.   '
a = st.strip()
print_with_borders(a)
print_with_borders(st.lstrip())
print_with_borders(st.rstrip())
b = st.replace('good', 'genius').replace('Python', 'C++');
print_with_borders(b)
dump_arr(b.split())
dump_arr(b.split(','))
dump_arr(b.split(' '))
print_with_borders('-'.join(b.split()))
print('Idx of \'good\': ', st.find('good'), sep='')
dump_arr(find_all(st, 'good'))
